﻿using IoTGateway.Model;
using Microsoft.EntityFrameworkCore;
using OpenIotModel;
using System.Data.Entity;
using DbContext = Microsoft.EntityFrameworkCore.DbContext;

namespace OpenIotMain.SQLiteTool
{
    public class SqliteDbContext : DbContext
    {
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlite("Data Source=E:\\vscode\\OpenIot\\OpenIot\\db\\Database.db");
            //optionsBuilder.UseSqlite("Data Source=E:\\wwwroot\\openiot\\Database.db");
            //var baseDir = AppDomain.CurrentDomain.BaseDirectory;
            //var dbPath = Path.Combine(baseDir, "db/Database.db");
            //optionsBuilder.UseSqlite($"Data Source={dbPath}");
        }
        public Microsoft.EntityFrameworkCore.DbSet<Device> device { get; set; }
        public Microsoft.EntityFrameworkCore.DbSet<DeviceVariable> deviceVariable { get; set; }
    }
}
